******************************************************************
**** Replication for "Non-Resident Prime Ministers"  ****
**** Sumitha Narayanan Kutty and Walter C. Ladwig III	****
**** 9/24/2024												  ****
******************************************************************

*** This code relies on a single dataset and produces the two substantive tables (4 and 6) reporting the results of the 4 logistic regression models.  It also produces two alternative specifications reported in the online appendix.

***This analysis was carried out using Stata 16.1
*******************************************************************************

**To report out the results, the estout package was employed.  It can be installed with the following command:
ssc install estout, replace


** Analysis starts here
clear
import delimited "Non Resident PM Dataset (ISQ)", numericc(2/150)
xtset cowid year

**Table 4_Base Model**
eststo clear
logistic pm_vis_bi_logit lag_mil_expln lag_indarms_inln lag_indexp13 lag_gdppcln lag_oilreservesln lag_indalign g7 rpower g77 lag_unemp13 lag_inflation13 lag_lnkcombc genelec F.genelec lag_nri_ln polity hrts rao deve_gowda singh vajpayee modi neighbor na ce cwa ea eurasia ew esa gulf ior ocean sea wana lag_pm_vis_bi_logit lag2_pm_vis_bi_logit lag_eam_vis_bi_logit lag2_eam_vis_bi_logit, vce(cluster cowid) coef
eststo
logistic eam_vis_bi_logit lag_mil_expln lag_indarms_inln lag_indexp13 lag_gdppcln lag_oilreservesln lag_indalign g7 rpower g77 lag_unemp13 lag_inflation13 lag_lnkcombc genelec F.genelec lag_nri_ln polity hrts rao deve_gowda singh vajpayee modi neighbor na ce cwa ea eurasia ew esa gulf ior ocean sea wana lag_eam_vis_bi_logit lag2_eam_vis_bi_logit lag_pm_vis_bi_logit lag2_pm_vis_bi_logit, vce(cluster cowid) coef
eststo
esttab using BaseModel.csv, replace compress n se aic b(%9.3f) se(%9.3f) star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

**Table 6_ Alignment model***
eststo clear
logistic pm_vis_bi_logit lag_mil_expln lag_indarms_inln lag_indexp13 lag_gdppcln lag_oilreservesln lag_indalign g7 rpower g77 lag_unemp13 lag_inflation13 lag_lnkcombc genelec F.genelec lag_nri_ln polity hrts unsanctions lag_usarms_outln usdefense ussanc russanc chisanc lag_rusarms_outln rusdefense lag_chiarms_outln lag_usalign lag_rusalign lag_chialign rao deve_gowda vajpayee singh modi neighbor na ce cwa ea eurasia ew esa gulf ior ocean sea wana lag_pm_vis_bi_logit lag2_pm_vis_bi_logit lag_eam_vis_bi_logit lag2_eam_vis_bi_logit, vce(cluster cowid) coef
eststo
logistic eam_vis_bi_logit lag_mil_expln lag_indarms_inln lag_indexp13 lag_gdppcln lag_oilreservesln lag_indalign g7 rpower g77 lag_unemp13 lag_inflation13 lag_lnkcombc genelec F.genelec lag_nri_ln polity hrts unsanctions lag_usarms_outln usdefense ussanc russanc chisanc lag_rusarms_outln rusdefense lag_chiarms_outln lag_usalign lag_rusalign lag_chialign rao deve_gowda vajpayee singh modi neighbor na ce cwa ea eurasia ew esa gulf ior ocean sea wana lag_pm_vis_bi_logit lag2_pm_vis_bi_logit lag_eam_vis_bi_logit lag2_eam_vis_bi_logit, vce(cluster cowid) coef
eststo
esttab using AlignmentModel.csv, replace compress n se aic b(%9.3f) se(%9.3f) star(+ 0.10 * 0.05 ** 0.01 *** 0.001)


***Appendix 2_Base model with days visited as the dependent variable****
eststo clear
poisson pm_vis_bi_days lag_mil_expln lag_indarms_inln lag_indexp13 lag_gdppcln lag_oilreservesln lag_indalign g7 rpower g77 lag_unemp13 lag_inflation13 lag_lnkcombc genelec F.genelec lag_nri_ln polity hrts rao deve_gowda singh vajpayee modi neighbor na ce cwa ea eurasia ew esa gulf ior ocean sea wana lag_pm_vis_bi_logit lag2_pm_vis_bi_logit lag_eam_vis_bi_logit lag2_eam_vis_bi_logit, vce(cluster cowid)
eststo
poisson eam_vis_bi_days lag_mil_expln lag_indarms_inln lag_indexp13 lag_gdppcln lag_oilreservesln lag_indalign g7 rpower g77 lag_unemp13 lag_inflation13 lag_lnkcombc genelec F.genelec lag_nri_ln polity hrts rao deve_gowda singh vajpayee modi neighbor na ce cwa ea eurasia ew esa gulf ior ocean sea wana lag_eam_vis_bi_logit lag2_eam_vis_bi_logit lag_pm_vis_bi_logit lag2_pm_vis_bi_logit, vce(cluster cowid)
eststo
esttab using Appendix2Model.csv, replace compress n se aic b(%9.3f) se(%9.3f) star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

***Appendix 3_Base model with Government type instead of Prime Ministerial tenure as a control variable****
eststo clear
logistic pm_vis_bi_logit lag_mil_expln lag_indarms_inln lag_indexp13 lag_gdppcln lag_oilreservesln lag_indalign g7 rpower g77 lag_unemp13 lag_inflation13 lag_lnkcombc genelec F.genelec lag_nri_ln polity hrts minority majority neighbor na ce cwa ea eurasia ew esa gulf ior ocean sea wana lag_pm_vis_bi_logit lag2_pm_vis_bi_logit lag_eam_vis_bi_logit lag2_eam_vis_bi_logit, vce(cluster cowid) coef
eststo
logistic eam_vis_bi_logit lag_mil_expln lag_indarms_inln lag_indexp13 lag_gdppcln lag_oilreservesln lag_indalign g7 rpower g77 lag_unemp13 lag_inflation13 lag_lnkcombc genelec F.genelec lag_nri_ln polity hrts minority majority neighbor na ce cwa ea eurasia ew esa gulf ior ocean sea wana lag_eam_vis_bi_logit lag2_eam_vis_bi_logit lag_pm_vis_bi_logit lag2_pm_vis_bi_logit, vce(cluster cowid) coef
eststo
esttab using Appendix3Model.csv, replace compress n se aic b(%9.3f) se(%9.3f) star(+ 0.10 * 0.05 ** 0.01 *** 0.001)